<div class="weadmin-body">
    <form class="layui-form" data-form='{:request()->url()}'>

        <div class="layui-form-item" pane>
            <label for="cid" class="layui-form-label">
                <span class="we-red">*</span>上级分类
            </label>
            <div class="layui-input-inline">
                <select id="cid" name="cid" required="" lay-verify="required">
                    <option value="0">请选择上级分类</option>
                    {volist name="cates" id="c"}
                    <option value="{$c.id}" {if (isset($vo.cid) and $vo.cid == $c.id) }selected{/if}>{$c._pre}{$c.title}</option>
                    {/volist}
                </select>
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="we-red">*</span>上级分类
            </div>
        </div>

        <div class="layui-form-item" pane>
            <label for="title" class="layui-form-label">
                <span class="we-red">*</span>文章标题
            </label>
            <div class="layui-input-block">
                <input type="text" id="title" name="title" required="" lay-verify="required"
                       value="{$vo.title|default=''}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="keyword" class="layui-form-label">
                <span class="we-red">*</span>关键词（标签）
            </label>
            <div class="layui-input-block">
                <input type="text" id="keyword" name="keyword" required="" lay-verify="required"
                       value="{$vo.keyword|default=''}" class="layui-input">
            </div>
        </div>


        <div class="layui-form-item">
            <label for="keyword" class="layui-form-label">
                <span class="we-red">*</span>缩略图
            </label>
            <div class="layui-input-inline">
                <button type="button" data-upload="{:url('admin/upload/file')}" data-field="thumb" data-type="images"
                        value="{$vo.thumb|default=''}" class="layui-btn">上传文件</button>
                <input type="hidden" name="thumb"
                       value="{$vo.thumb|default=''}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <img data-preview="thumb" style="max-width: 150px;max-height: 150px" src="{$vo.thumb|default=''}">
                点击图片删除
            </div>
        </div>

        <div class="layui-form-item">
            <label for="description" class="layui-form-label">
                <span class="we-red">*</span>摘要
            </label>
            <div class="layui-input-block">
                <textarea id="description" name="description" required="" lay-verify="required" class="layui-textarea">{$vo.description|default=''}</textarea>
            </div>
        </div>

        {eq name="Think.config.liteadmin.editor" value="markdown"}
        <div class="layui-form-item">
            <label for="md_content" class="layui-form-label">
                <span class="we-red">*</span>正文
            </label>
            <div class="layui-input-block">
                <div id="md_content_div" style="height: 200px">
                    <textarea id="md_content" name="md_content" hidden>{if isset($vo.md_content)}{$vo.md_content|raw}{/if}</textarea>
                </div>
            </div>
            <div class="layui-form-mid layui-word-aux">
            </div>
        </div>
        {else/}
        <div class="layui-form-item">
            <label for="content" class="layui-form-label">
                <span class="we-red">*</span>正文
            </label>
            <div class="layui-input-block">
                <textarea id="content" name="content" hidden>{if isset($vo.content)}{$vo.content|raw}{/if}</textarea>
            </div>
            <div class="layui-form-mid layui-word-aux">
            </div>
        </div>
        {/eq}

        <div class="layui-form-item layui-col-xs10 layui-col-xs-offset2">
            {if isset($vo.id)}<input type="hidden" name="id" value="{$vo.id}">{/if}
            <button class="layui-btn" lay-submit="">确定</button>
        </div>
    </form>
</div>

<script>
    layui.use('form',function () {
        layui.form.render();
    })
</script>
{eq name="Think.config.liteadmin.editor" value="markdown"}
<script>
    layui.use('jquery',function () {
        var $ = layui.jquery,
            jQuery = layui.jquery;
        var editor = editormd("md_content_div", {
            path : "__ADMINS__/lib/editor.md/lib/",
            height : 400,
            imageUpload:true,
            imageUploadURL:'{:url("admin/upload/markdown")}',
            // uploadCallbackURL:'sdgf',
            // saveHTMLToTextarea : true
        });
    });
</script>
{else/}
<script>
    layui.use('jquery',function () {
        var $ = layui.jquery,
        jQuery = layui.jquery;
        $(function () {
            CKEDITOR.replace( 'content',{
                uiColor: '#009688',
                baseFloatZIndex:999999999,
                extraPlugins:'autogrow',
                autoGrow_bottomSpace:50,
                autoGrow_onStartup:true,
                filebrowserImageUploadUrl:'{:url("admin/upload/ckeditor")}',
            });
        });
    });
</script>
{/eq}